package cn.itcast.nems.product.scheduler;

import cn.itcast.nems.product.dao.dataobject.TuitionFeeDO;

import java.time.LocalDate;
import java.util.Comparator;

/**
 * author liyong
 * create: 2024-03-08 16:44:30
 **/
public class TuitionFeeDOCompare implements Comparator<TuitionFeeDO> {

    @Override
    public int compare(TuitionFeeDO o1, TuitionFeeDO o2) {
        final LocalDate s1 = o1.getStartDate();
        final LocalDate s2 = o2.getStartDate();
        if (s1 != null && s2 != null) {
            return s1.compareTo(s2);
        }
        return o1.getUseDate().compareTo(o2.getUseDate());
    }
}
